import 'package:flutter/material.dart';

class OrderSubmitWidget extends StatelessWidget {
  num unitNumber;
  num otherNumber;
  String goodsName;
  String goodsContent;

  OrderSubmitWidget(
      this.unitNumber, this.otherNumber, this.goodsName, this.goodsContent);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.transparent,
      body: WillPopScope(
        onWillPop: () async {
          return Future.value(false);
        },
        child: Center(
          child: SizedBox(
            width: double.infinity,
            child: Stack(
              alignment: Alignment.center,
              children: [
                ClipRRect(
                  borderRadius: const BorderRadius.all(
                    Radius.circular(4),
                  ),
                  child: Container(
                    color: Colors.white,
                    padding:
                        const EdgeInsets.only(top: 14, left: 12, right: 12),
                    width: 280,
                    child: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        const Padding(
                          padding: EdgeInsets.only(top: 1, bottom: 14),
                          child: Text(
                            "温馨提示",
                            style: TextStyle(
                              fontWeight: FontWeight.bold,
                              fontSize: 16,
                            ),
                          ),
                        ),
                        Divider(),
                        SizedBox(
                          height: 12,
                        ),
                        Column(
                          mainAxisSize: MainAxisSize.min,
                          children: [
                            Container(
                              child: RichText(
                                //文字居中
                                textAlign: TextAlign.center,
                                //文字区域
                                text: TextSpan(
                                  text: "您将花费",
                                  style: TextStyle(
                                      color: Colors.black, fontSize: 16),
                                  children: [
                                    TextSpan(
                                      text: "$unitNumber积分兑换",
                                      style: TextStyle(color: Colors.blue),
                                    ),
                                    TextSpan(
                                      text: "$goodsName",
                                      style: TextStyle(color: Colors.grey),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            Container(
                              margin: EdgeInsets.only(top: 8, bottom: 20),
                              child: Text(
                                "$goodsContent",
                                style: TextStyle(
                                    color: Colors.black, fontSize: 14),
                              ),
                            )
                          ],
                        ),
                        Divider(),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            TextButton(
                              onPressed: () {
                                Navigator.of(context).pop(false);
                              },
                              child: Text("取消"),
                            ),
                            SizedBox(
                              height: 34,
                              child: TextButton(
                                onPressed: () async {
                                  Navigator.of(context).pop(true);
                                },
                                child: const Text("确认"),
                              ),
                            )
                          ],
                        )
                      ],
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
